<template>
  <view class="blog-discovery-page">
    <!-- 顶部标题和图标区 -->
    <header class="app-header">
      <h1 class="app-title">博客发现</h1>
      <view class="header-icons">
        <text class="icon search-icon">
          <!-- 搜索图标占位 -->465
          <!-- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M15.5 14H14.71L14.43 13.73C15.41 12.59 16 11.11 16 9.5C16 5.91 13.09 3 9.5 3C5.91 3 3 5.91 3 9.5C3 13.09 5.91 16 9.5 16C11.11 16 12.59 15.41 13.73 14.43L14 14.71V15.5L19 20.49L20.49 19L15.5 14ZM9.5 14C7.01 14 5 11.99 5 9.5C5 7.01 7.01 5 9.5 5C11.99 5 14 7.01 14 9.5C14 11.99 11.99 14 9.5 14Z" fill="#555"/>
          </svg> -->
        </text>
        <text class="icon notification-icon">
          <!-- 通知图标占位 -->123
          <!-- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M12 22C13.1 22 14 21.1 14 20H10C10 21.1 10.9 22 12 22ZM18 16V11C18 7.93 16.37 5.36 13.5 4.68V4C13.5 3.17 12.83 2.5 12 2.5C11.17 2.5 10.5 3.17 10.5 4V4.68C7.64 5.36 6 7.92 6 11V16L4 18V19H20V18L18 16Z" fill="#555"/>
          </svg> -->
        </text>
      </view>
    </header>

    <!-- 分类标签区域 -->
    <view class="categories" @click="check($event)">
      <view class="category" v-for="(item,index) in labellist" :class="item.active?'active':''" 
	  :data-index="index" :key="index">{{item.name}}</view>
    </view>

    <!-- 博客列表 -->
    <view class="blog-list">
		<!-- 博客 -->
	  <boke></boke>
    </view>

  </view>
</template>
<script>
	import boke from "@/component/boke.vue"
	export default{
		name:"findPage",
		components:{
			boke
		},
		data(){
			return{
				labellist:[
					{name:"全部",active:false},
					{name:"科技",active:false},
					{name:"生活",active:true},
					{name:"美食",active:false},
					{name:"旅行",active:false},
				],
				showlist:[]  ,//展示列表
				datalist:[]  ,//所有数据列表
				
			}
		},
		methods:{
			check(e){
				console.log(e);
				console.log("////////");
				for(var i in this.labellist){
					this.labellist[i].active = false
				}
				this.labellist[e.target.dataset.index].active = true
			},
			search(){
				this.showlist
			}
		}
	}
	
</script>

<style scoped>
/* 全局样式 */
/* * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
} */

.blog-discovery-page {
  background-color: #f8f9fa; /* 浅灰色背景 */
  max-width: 500px; /* 移动端宽度限制 */
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部标题和图标区域 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.header-icons {
  display: flex;
  gap: 18px;
}

.icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 分类标签区域 */
.categories {
  display: flex;
  padding: 16px 16px 8px;
  gap: 12px;
  overflow-x: auto;
  background-color: white;
  scrollbar-width: none; /* Firefox */
}

.categories::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.category {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  color: #555;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  white-space: nowrap;
  cursor: pointer;
}

.category.active {
  background-color: #663399; /* 紫色 */
  color: white;
  border-color: #663399;
}

/* 博客列表   244-343*/   
.blog-list {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

/* .blog-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  overflow: hidden;
}

.blog-cover {
  position: relative;
  height: 180px;
  background-color: #f1f3f4;
}

.cover-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9e9e9e;
  font-size: 0.9rem;
}

.blog-info {
  padding: 16px;
}

.blog-meta {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.blog-category {
  background-color: #f0f7ff;
  color: #1890ff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 10px;
}

.blog-time {
  font-size: 0.8rem;
  color: #9e9e9e;
}

.blog-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.blog-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.author {
  font-size: 0.9rem;
  color: #666;
}

.stats {
  display: flex;
  gap: 16px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #9e9e9e;
} */

/* 底部导航 */
.bottom-nav {
  display: flex;
  background-color: white;
  border-top: 1px solid #f0f0f0;
  padding: 8px 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
}

.nav-icon {
  display: flex;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 0.7rem;
  color: #666;
}

.nav-item.active .nav-label {
  color: #663399;
}
</style>